Fix update of the magnetic field#15632
Open
romainschotter wants to merge 1 commit into
Open
Conversation
shahor02
approved these changes
Jul 24, 2026
shahor02
left a comment
Collaborator
There was a problem hiding this comment.
@romainschotter thanks, the fix is correct.
Could you hint at how you re-initialise it in the analysis for different runs?
In principle, if it is done via GRPGeomHelper, there no need to delete the field: the field GRP is a function if timestamp rather than the run number, one simply updates the current values.
sawenzel
marked this pull request as ready for review
July 25, 2026 09:32
sawenzel
approved these changes
Jul 25, 2026
sawenzel
left a comment
Collaborator
There was a problem hiding this comment.
Looks ok to me.
For full consistency, one should probably also do Instance()->mFieldFast = nullptr next to the mField reset in both overloads to remove the implicit dependency on updateField()'s internal branch condition for correctness of the fast-field cache.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When using the standard CCDB loader, the magnetic field is initialised correctly.
However, when processing a second file from a different run, the
TGeoGlobalMagFieldinstance is deleted (AliceO2/Detectors/Base/src/Propagator.cxx
Line 131 in 10eb61e
mFieldis not reset (AliceO2/Detectors/Base/src/Propagator.cxx
Line 51 in 10eb61e
As a result, it becomes a dangling pointer and can return completely nonsensical magnetic field values (e.g. around 2e+22). The pointer therefore needs to be refreshed by calling
updateField. Furthermore,updateFieldonly updates the magnetic field if the pointermFieldis a nullptr. IfmFieldexists but points to invalid memory,updateFielddoes not update the magnetic field, so this logic also had to be fixed.Thank you @fchinu for reporting this bug!
@ddobrigk @dsekihat for your information!